3.50 \(\int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx\)

Optimal. Leaf size=39 \[ x \left (a^2-b^2\right )-\frac{2 a b \log (\cos (c+d x))}{d}+\frac{b^2 \tan (c+d x)}{d} \]

[Out]

(a^2 - b^2)*x - (2*a*b*Log[Cos[c + d*x]])/d + (b^2*Tan[c + d*x])/d

________________________________________________________________________________________

Rubi [A]  time = 0.0564281, antiderivative size = 39, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.107, Rules used = {3086, 3477, 3475} \[ x \left (a^2-b^2\right )-\frac{2 a b \log (\cos (c+d x))}{d}+\frac{b^2 \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

(a^2 - b^2)*x - (2*a*b*Log[Cos[c + d*x]])/d + (b^2*Tan[c + d*x])/d

Rule 3086

Int[cos[(c_.) + (d_.)*(x_)]^(m_)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Symb
ol] :> Int[(a + b*Tan[c + d*x])^n, x] /; FreeQ[{a, b, c, d}, x] && EqQ[m + n, 0] && IntegerQ[n] && NeQ[a^2 + b
^2, 0]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx &=\int (a+b \tan (c+d x))^2 \, dx\\ &=\left (a^2-b^2\right ) x+\frac{b^2 \tan (c+d x)}{d}+(2 a b) \int \tan (c+d x) \, dx\\ &=\left (a^2-b^2\right ) x-\frac{2 a b \log (\cos (c+d x))}{d}+\frac{b^2 \tan (c+d x)}{d}\\ \end{align*}

Mathematica [C]  time = 0.123585, size = 69, normalized size = 1.77 \[ \frac{2 b^2 \tan (c+d x)-i \left ((a+i b)^2 \log (-\tan (c+d x)+i)-(a-i b)^2 \log (\tan (c+d x)+i)\right )}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

((-I)*((a + I*b)^2*Log[I - Tan[c + d*x]] - (a - I*b)^2*Log[I + Tan[c + d*x]]) + 2*b^2*Tan[c + d*x])/(2*d)

________________________________________________________________________________________

Maple [A]  time = 0.095, size = 57, normalized size = 1.5 \begin{align*}{a}^{2}x-{b}^{2}x+{\frac{{b}^{2}\tan \left ( dx+c \right ) }{d}}-2\,{\frac{ab\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}+{\frac{{a}^{2}c}{d}}-{\frac{{b}^{2}c}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x)

[Out]

a^2*x-b^2*x+b^2*tan(d*x+c)/d-2*a*b*ln(cos(d*x+c))/d+1/d*a^2*c-1/d*b^2*c

________________________________________________________________________________________

Maxima [A]  time = 1.69376, size = 66, normalized size = 1.69 \begin{align*} \frac{{\left (d x + c\right )} a^{2} -{\left (d x + c - \tan \left (d x + c\right )\right )} b^{2} - a b \log \left (-\sin \left (d x + c\right )^{2} + 1\right )}{d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

((d*x + c)*a^2 - (d*x + c - tan(d*x + c))*b^2 - a*b*log(-sin(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]  time = 0.493956, size = 146, normalized size = 3.74 \begin{align*} \frac{{\left (a^{2} - b^{2}\right )} d x \cos \left (d x + c\right ) - 2 \, a b \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + b^{2} \sin \left (d x + c\right )}{d \cos \left (d x + c\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

((a^2 - b^2)*d*x*cos(d*x + c) - 2*a*b*cos(d*x + c)*log(-cos(d*x + c)) + b^2*sin(d*x + c))/(d*cos(d*x + c))

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a \cos{\left (c + d x \right )} + b \sin{\left (c + d x \right )}\right )^{2} \sec ^{2}{\left (c + d x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)**2*(a*cos(d*x+c)+b*sin(d*x+c))**2,x)

[Out]

Integral((a*cos(c + d*x) + b*sin(c + d*x))**2*sec(c + d*x)**2, x)

________________________________________________________________________________________

Giac [A]  time = 1.15995, size = 59, normalized size = 1.51 \begin{align*} \frac{a b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + b^{2} \tan \left (d x + c\right ) +{\left (a^{2} - b^{2}\right )}{\left (d x + c\right )}}{d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

(a*b*log(tan(d*x + c)^2 + 1) + b^2*tan(d*x + c) + (a^2 - b^2)*(d*x + c))/d